//
//  GSSubscribeViewController_Add_Topic_Details_Cell.m
//  GameSky
//
//  Created by lanou on 16/1/12.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSSubscribeViewController_Add_Topic_Details_Cell.h"

@implementation GSSubscribeViewController_Add_Topic_Details_Cell
#pragma mark-------------自定义初始化------------------
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 夜间模式
        self.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);
        
        CGFloat height = kScreenWidth * 0.225;
        CGFloat width = kScreenWidth / 4;
// 图片
        _imageV = [[UIImageView alloc] initWithFrame:CGRectMake(8, 8, width, height - 16)];
        //_imageV.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_imageV];
// title
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_imageV.right + 8, _imageV.top, kScreenWidth - _imageV.right - 16, height / 2)];
        //_titleLabel.backgroundColor = [UIColor greenColor];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_titleLabel];
// 评论
        _commentLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.left, _titleLabel.bottom, _titleLabel.width - 5, _imageV.height - _titleLabel.height)];
        _commentLabel.font = [UIFont systemFontOfSize:14];
        _commentLabel.textAlignment = NSTextAlignmentRight;
        //_commentLabel.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:_commentLabel];
        
    }
    return self;
}

#pragma mark-----------------重写setter方法---------------
- (void)setModel:(GSSubscrebe_Add_Topic_Details *)model{
    _model = model;
// 各个控件赋值
    // 图片
    [_imageV sd_setImageWithURL:[NSURL URLWithString:model.thumbnailURLs[0]] placeholderImage:nil];
    // title
    _titleLabel.text = model.title;
    // 评论
    _commentLabel.text = [NSString stringWithFormat:@"%@评论",model.commentsCount];

}
#pragma mark--------------------------------------------------
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
